import ExchangeToys from '@/mock/exchange'

export function getExchangeToy(id) {
  return ExchangeToys.find(item => item.id === id)
}

export function addExchangeToy(toy) {
  const data = JSON.parse(getStorage('exchangeToys'))

  data.push({
    id: data.length + 1,
    ...toy
  })
  setStorage('exchangeToys', JSON.stringify(data))
}
